package com.pomr.model.equipmentstorage;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pomr.model.health.PersonRecord;
import com.pomr.model.sys.User;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @作者：Administrator
 * @时间：22:56 2018/8/14 0014
 * @用途：设备-用户绑定记录表
 * 解绑不删除记录 仅记录解绑日期，保证记录完整
 **/
@Entity
@Table(name="equipment_leader")
public class EquipmentLeader implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
    private Integer id;//主键
    @ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="record_id")
    private PersonRecord record;//个人档案主键
    @Column(name="leadername",length = 20)
    private String leadername;//绑定人姓名
    @Column(name="leaderidcard",length = 30)
    private String leaderidcard;//绑定人身份证号
    @Column(name="user_no",length = 2)
    private String userNo;//用户编号

    @ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="receive_id")
    private Receive receive;//领用记录

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name="create_time")
    private Date createTime;//创建日期

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name="nouse_time")
    private Date nouseTime;//解绑日期

    @ManyToOne
    @JoinColumn(name="create_user")
    private User createUser;//创建人员id

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public PersonRecord getRecord() {
        return record;
    }

    public void setRecord(PersonRecord record) {
        this.record = record;
    }

    public String getLeadername() {
        return leadername;
    }

    public void setLeadername(String leadername) {
        this.leadername = leadername;
    }

    public String getLeaderidcard() {
        return leaderidcard;
    }

    public void setLeaderidcard(String leaderidcard) {
        this.leaderidcard = leaderidcard;
    }

    public Receive getReceive() {
        return receive;
    }

    public void setReceive(Receive receive) {
        this.receive = receive;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getNouseTime() {
        return nouseTime;
    }

    public void setNouseTime(Date nouseTime) {
        this.nouseTime = nouseTime;
    }

    public User getCreateUser() {
        return createUser;
    }

    public void setCreateUser(User createUser) {
        this.createUser = createUser;
    }

    public String getUserNo() {
        return userNo;
    }

    public void setUserNo(String userNo) {
        this.userNo = userNo;
    }
}
